﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UniCT.LinkShareWpf.Runtime;
using UniCT.LinkShareWpf.Interface;
using UniCT.LinkShareWpf.CommunicationChannel;

namespace LinkShareWpf
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        InsertResourceForm irf;
        public MainWindow()
        {
            // VERIFICARE IL CASO IN CUI IL FILE XML NON ESISTE O E' VUOTO
            InitializeComponent();
            //irf = new InsertResourceForm();
            //irf.Show();
     
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //MyResources prova = MyResources.Read();
      
            //Resource r1 = MyResources.Instance.Read().Resources.ToArray<Resource>()[0];
            //TechnicalInfo t1 = r1.TInfo;
            //ContentInfo c1 = r1.CInfo;
            
            ////Console.WriteLine(t1);
            ////Console.WriteLine(c1);

            //Resource r2 = MyResources.Instance.Read().Resources.ToArray<Resource>()[1];
            //TechnicalInfo t2= r2.TInfo;
            //ContentInfo c2 = r2.CInfo;

            ////Console.WriteLine(t2);
            ////Console.WriteLine(c2);

        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            // SCRITTURA XML

            //ContentInfo ci = new ContentInfo();
            //ci.Director = "Director1";
            //ci.Title = "Titolo1";
            //ci.Storyline = "Tramaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
            //ci.Genre = EnumGenre.Commedia;
            //ci.Language = EnumLanguage.Italiano;
            //ci.SubTitleLanguage = EnumLanguage.Giapponese;
            //ci.Year = 2001;
            //ci.Duration = 120;

            //TechnicalInfo ti = new TechnicalInfo();
            //ti.MegaByte = 123;
            //ti.VideoType = EnumVideoType.Avi;
            //ti.VideoSource = EnumVideoSource.DVDMux;
            //ti.AudioSource = EnumAudioSource.DTS;

            //Resource r1 = new Resource(ti, ci);
            //r1.Rating = 10;
            //r1.Url = @"Http:\\wwwwwwwwwwww";

            //ContentInfo ci2 = new ContentInfo();
            //ci2.Director = "Director12";
            //ci2.Title = "Titolo12";
            //ci2.Storyline = "Tramaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2";
            //ci2.Genre = EnumGenre.Biografia;
            //ci2.Language = EnumLanguage.Arabo;
            //ci2.SubTitleLanguage = EnumLanguage.Cinese;
            //ci2.Year = 2202;
            //ci2.Duration = 2122;

            //TechnicalInfo ti2 = new TechnicalInfo();
            //ti2.MegaByte = 123;
            //ti2.VideoType = EnumVideoType.Avi;
            //ti2.VideoSource = EnumVideoSource.DVDMux;
            //ti2.AudioSource = EnumAudioSource.DTS;

            //Resource r2 = new Resource(ti2, ci2);
            //r2.Rating = 1000;
            ////r2.Url = @"Http:\\";
            
            //MyResources ooo = MyResources.Instance.Read();
            //ooo.Resources.Add(irf.getResource());
            //ooo.Save();

            

        }

        private void button4_Click(object sender, RoutedEventArgs e)
        {
            //Server service = new Server(Int32.Parse(txtPort.Text), "LinkShare");
            //service.Start();

        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
            //Channel chan = new Channel(txtTarget.Text, Int32.Parse(txtPortTarget.Text), "LinkShare");
            //txtPing.Text= chan.Client.Ping(Environment.TickCount)+" ms";
            
        }

        private void button5_Click(object sender, RoutedEventArgs e)
        {
          
            
        }

        private void Save_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
          //  e.CanExecute = groupBox3.//!(string.IsNullOrEmpty(this.textBox1.Text) || string.IsNullOrEmpty(this.textBox2.Text));

        }

        private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, TextChangedEventArgs e)
        {

        }
  


    }
}
